package com.slz3.business.module.configManagement.conShareManage.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.configManagement.conShareManage.domain.ConShareManage;
import com.slz3.business.module.configManagement.conShareManage.domain.ConShareManageCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class ConShareManageResController{
    @Resource
    private ConShareManageResAtomic conShareManageResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, ConShareManage conShareManage) {
        if (ConShareManageResUnsafeValid.add(req, conShareManage)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.add_$ConShareManageUpdateLock(req, conShareManage);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, ConShareManageCondition conShareManageCondition) {
        if (ConShareManageResUnsafeValid.delete(req, conShareManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.delete_$ConShareManageUpdateLock(req, conShareManageCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, ConShareManage conShareManage) {
        if (ConShareManageResUnsafeValid.modify(req, conShareManage)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.modify_$ConShareManageUpdateLock(req, conShareManage);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (ConShareManageResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConShareManageResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return conShareManageResAtomic.info_$ConShareManageUpdateLock(req);
        if (ConShareManageResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.info_$ConShareManageUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (ConShareManageResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConShareManageResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, ConShareManageCondition conShareManageCondition) {
        //
        if (ConShareManageResUnsafeValid.auditSubmit(req, conShareManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.auditSubmit_$ConShareManageUpdateLock(req, conShareManageCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, ConShareManageCondition conShareManageCondition) {
        if (ConShareManageResUnsafeValid.audit(req, conShareManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.audit_$ConShareManageUpdateLock(req, conShareManageCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, ConShareManageCondition conShareManageCondition) {
        if (ConShareManageResUnsafeValid.auditReject(req, conShareManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.auditReject_$ConShareManageUpdateLock(req, conShareManageCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, ConShareManageCondition conShareManageCondition) {
        if (ConShareManageResUnsafeValid.usingEnable(req, conShareManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.usingEnable_$ConShareManageUpdateLock(req, conShareManageCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, ConShareManageCondition conShareManageCondition) {
        if (ConShareManageResUnsafeValid.usingDisable(req, conShareManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conShareManageResAtomic.usingDisable_$ConShareManageUpdateLock(req, conShareManageCondition);
        }
    }

}
